package algorithm.queue;

import java.util.Random;

/**
 * @author bingo
 * @Description
 * @Date 2018/5/28
 */
public class Main {

    public static double testTime(Queue queue ,int count){

        long startTime = System.nanoTime();

        Random random = new Random();

        for(int i=0;i<count;i++){
            queue.enqueue(random.nextInt(Integer.MAX_VALUE));
        }

        for(int i=0;i<count;i++){
            queue.dequeue();
        }

        long endTime = System.nanoTime();

        return  (endTime-startTime)/1000000000.0;
    }

    public static void main(String[] args) {
        int count = 100000;

        ArrayQueue arrayQueue = new ArrayQueue(count);
        LoopQueue loopQueue = new LoopQueue(count);
        LinkedListQueue linkedListQueue = new LinkedListQueue();
        System.out.println("ArrayQueue--->"+Main.testTime(arrayQueue,count));
        System.out.println("LoopQueue"+Main.testTime(loopQueue,count));
        System.out.println("linkedListQueue"+Main.testTime(linkedListQueue,count));



    }
}
